# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Content.V21.Model.ReturnPolicyOnline do
  @moduledoc """
  Return policy online object. This is currently used to represent return policies for ads and free listings programs.

  ## Attributes

  *   `countries` (*type:* `list(String.t)`, *default:* `nil`) - The countries of sale where the return policy is applicable. The values must be a valid 2 letter ISO 3166 code, e.g. "US".
  *   `itemConditions` (*type:* `list(String.t)`, *default:* `nil`) - The item conditions that are accepted for returns. This is required to not be empty unless the type of return policy is noReturns.
  *   `label` (*type:* `String.t`, *default:* `nil`) - The unique user-defined label of the return policy. The same label cannot be used in different return policies for the same country. Policies with the label 'default' will apply to all products, unless a product specifies a return_policy_label attribute.
  *   `name` (*type:* `String.t`, *default:* `nil`) - The name of the policy as shown in Merchant Center.
  *   `policy` (*type:* `GoogleApi.Content.V21.Model.ReturnPolicyOnlinePolicy.t`, *default:* `nil`) - The return policy.
  *   `restockingFee` (*type:* `GoogleApi.Content.V21.Model.ReturnPolicyOnlineRestockingFee.t`, *default:* `nil`) - The restocking fee that applies to all return reason categories. This would be treated as a free restocking fee if the value is not set.
  *   `returnMethods` (*type:* `list(String.t)`, *default:* `nil`) - The return methods of how customers can return an item. This value is required to not be empty unless the type of return policy is noReturns.
  *   `returnPolicyId` (*type:* `String.t`, *default:* `nil`) - Output only. Return policy ID generated by Google.
  *   `returnPolicyUri` (*type:* `String.t`, *default:* `nil`) - The return policy uri. This can used by Google to do a sanity check for the policy.
  *   `returnReasonCategoryInfo` (*type:* `list(GoogleApi.Content.V21.Model.ReturnPolicyOnlineReturnReasonCategoryInfo.t)`, *default:* `nil`) - The return reason category information. This required to not be empty unless the type of return policy is noReturns.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :countries => list(String.t()) | nil,
          :itemConditions => list(String.t()) | nil,
          :label => String.t() | nil,
          :name => String.t() | nil,
          :policy => GoogleApi.Content.V21.Model.ReturnPolicyOnlinePolicy.t() | nil,
          :restockingFee => GoogleApi.Content.V21.Model.ReturnPolicyOnlineRestockingFee.t() | nil,
          :returnMethods => list(String.t()) | nil,
          :returnPolicyId => String.t() | nil,
          :returnPolicyUri => String.t() | nil,
          :returnReasonCategoryInfo =>
            list(GoogleApi.Content.V21.Model.ReturnPolicyOnlineReturnReasonCategoryInfo.t()) | nil
        }

  field(:countries, type: :list)
  field(:itemConditions, type: :list)
  field(:label)
  field(:name)
  field(:policy, as: GoogleApi.Content.V21.Model.ReturnPolicyOnlinePolicy)
  field(:restockingFee, as: GoogleApi.Content.V21.Model.ReturnPolicyOnlineRestockingFee)
  field(:returnMethods, type: :list)
  field(:returnPolicyId)
  field(:returnPolicyUri)

  field(:returnReasonCategoryInfo,
    as: GoogleApi.Content.V21.Model.ReturnPolicyOnlineReturnReasonCategoryInfo,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.Content.V21.Model.ReturnPolicyOnline do
  def decode(value, options) do
    GoogleApi.Content.V21.Model.ReturnPolicyOnline.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V21.Model.ReturnPolicyOnline do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
